package main

import (
	"fmt"
	"os"

	"github.com/spf13/cobra"
)

var Verbose bool
var Region string

var rootCmd = &cobra.Command{
	Use: "hugo",
	Short: `A Fast and Flexible Static Site Generator built with
                love by spf13 and friends in Go.
                Complete documentation is available at https://gohugo.io`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("hugo running...")
		fmt.Printf("Verbose: %v\n", Verbose)
		fmt.Printf("Region: %v\n", Region)
	},
}

var versionCmd = &cobra.Command{
	Use:   "version",
	Short: "Print the version number of Hugo",
	Long:  `All software has versions. This is Hugo's`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Hugo Static Site Generator v0.9 -- HEAD")
	},
}

func Execute() {
	rootCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, "verbose output")
	rootCmd.Flags().StringVarP(&Region, "region", "r", "", "AWS region (required)")
	rootCmd.MarkFlagRequired()
	rootCmd.AddCommand(versionCmd)
	if err := rootCmd.Execute(); err != nil {
		fmt.Println("err: ", err)
		os.Exit(-1)
	}
}

func main() {
	Execute()
}
